<?
require_once("cms/core/helper/bean/Abstract.php");
require_once("cms/core/om/CountryPeer.php");
require_once("cms/guide/om/GuidePeer.php");
require_once("cms/guide/om/GuideI18nPeer.php");

class PHP_CMS_View_Helper_Guides extends AbstractList {

    public function guides($form=null) {

        if($this->isInit)
            return $this;

        parent::init($form);

        if(strlen($form->getLanguage()) > 0)
            $this->criteria->add(GuideI18nPeer::LANGUAGE_CODE,
                $form->getLanguage());


        if(strlen($form->getQuery()) == 0 && strlen($form->getLanguage()) == 0)
            $this->criteria->add(
                GuideI18nPeer::LANGUAGE_CODE,
                $this->param(_Core::DEFAULT_LANGUAGE)
            );

        $this->criteria->addJoin(GuidePeer::COUNTRY_CODE,
            CountryPeer::CODE);

        return $this;

    }


    /**
     * Define the propel method we are going to use to list
     * page items.
     */
    public function getMethod() {
        return "doSelectJoinAll";
    }


    /**
     * Define the propel peer we are going to use to list
     * page items.
     */
    public static function getPeer() {
        return new GuideI18nPeer();
    }


    /**
     * Return the searchable fields for this list page.
     */
    public static function getFields() {
        return array(
            GuidePeer::URL,
            GuideI18nPeer::DESCRIPTION1,
            GuideI18nPeer::DESCRIPTION2,
            CountryPeer::PRINTABLE_NAME,
            GuideI18nPeer::INSERT_DATE,
            GuideI18nPeer::MODIFIED_DATE
        );
    }
}
?>